package com.lh.pattern.proxy;

import java.lang.reflect.Method;

public class TimeInvocationHandler implements InvocationHandler {

	private Object target;

	public TimeInvocationHandler(Object target) {
		super();
		this.target = target;
	}

	@Override
	public void invoke(Object o, Method m) {
		long time1 = System.currentTimeMillis();
		System.out.println("time1=" + time1);
		try {
			m.invoke(target);
		} catch (Exception e) {
			e.printStackTrace();
		}
		long time2 = System.currentTimeMillis();
		System.out.println("time2=" + time2);
		System.out.println("Tank 的启动时间:" + (time2 - time1));
	}

}
